home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / bash_completion.d / gpg2 < prev    next >
Text File  |  2009-04-02  |  1KB  |  45 lines

  1. # -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
  2. # ex: ts=8 sw=8 noet filetype=sh
  3. #
  4. # gpg2(1) completion
  5. #
  6. have gpg2 && {
  7. _gpg2 ()
  8. {
  9.     local cur prev
  10.     
  11.     COMPREPLY=()
  12.     cur=`_get_cword`
  13.     prev=${COMP_WORDS[COMP_CWORD-1]}
  14.     
  15.     case "$prev" in
  16.         --homedir)
  17.             _filedir -d
  18.             return 0
  19.             ;;
  20.         -@(s|-sign|-clearsign|-options|-decrypt))
  21.             _filedir
  22.             return 0
  23.             ;;
  24.         --@(export|@(?(l|nr|nrl)sign|edit)-key))
  25.             # return list of public keys
  26.             COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" ))
  27.             return 0
  28.             ;;
  29.         -@(r|-recipient))
  30.             COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
  31.             if [ -e ~/.gnupg/gpg.conf ]; then
  32.                 COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf)" -- "$cur"))
  33.             fi
  34.         return 0
  35.         ;;
  36.     esac
  37.     
  38.     if [[ "$cur" == -* ]]; then
  39.         COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \
  40.                                     -n -N -i -h -R -t $(gpg2 --dump-options)' -- $cur ) )
  41.     fi
  42. } &&
  43. complete -F _gpg2 $default gpg2
  44. }
  45.